Evaluation Lab3 - Visualization

Note : Please run the python Notebook incase some of the Plots are not visible.

Plotly, Bokeh, Tableau may not be Visible.

Athul Mathew CB.EN.P2AID20016 19AI704

  1. Plot the latitudes and longitudes of any 5 cities in India (include your hometown as well), on the map.
In [1]:
import pandas as pd  
    
# List1  
lst = [['Trivandrum', 8.5241, 76.9366], 
       ['Delhi', 28.7041, 77.1025], 
       ['Himachal Pradesh', 31.1048, 77.1734], 
       ['Pune', 18.5204, 73.8567],
      ['Peruvallur', 11.1053, 75.9330]] 
    
df_india = pd.DataFrame(lst, columns =["City", "Latitude", "Longitude" ]) 
df_india
Out[1]:
City Latitude Longitude
0 Trivandrum 8.5241 76.9366
1 Delhi 28.7041 77.1025
2 Himachal Pradesh 31.1048 77.1734
3 Pune 18.5204 73.8567
4 Peruvallur 11.1053 75.9330
In [2]:
import plotly.graph_objects as go

mapbox_access_token = "pk.eyJ1IjoiYXRodWxtYXRoZXdrb25vb3IiLCJhIjoiY2ttazMyY2w4MGQxcDJucGh3NzJteHdrbyJ9.0-RxoHvUceNoUgvrOU17Dg"

fig = go.Figure(go.Scattermapbox(
        lat=df_india["Latitude"],
        lon=df_india["Longitude"],
        mode='markers',
        marker=go.scattermapbox.Marker(
            size=14
        ),
        text=df_india["City"],
    ))

fig.update_layout(
    hovermode='closest',
    mapbox=dict(
        accesstoken=mapbox_access_token,
        bearing=0,
        center=go.layout.mapbox.Center(
            lat=20,
            lon=78
        ),
        pitch=0,
        zoom=2.5
    )
)

fig.show()
  1. Sales of Riding Mowers: A company that manufactures riding mowers wants to identify the best sales prospects for an intensive sales campaign. In particular, the manufacturer is interested in classifying households as prospective owners or non-owners on the basis of Income (in $1000s) and Lot Size (in 1000 ft2). The marketing expert looked at a random sample of 24 households, given in the file RidingMowers.csv. Create a scatter plot of Lot Size vs. Income, based on the outcome variable owner/non-owner with legible labels and a legend
In [3]:
import pandas as pd

import seaborn as sns
import matplotlib.pyplot as plt

url = "https://raw.githubusercontent.com/toshihiroryuu/Dataset-test/main/RidingMowers.csv"

df = pd.read_csv(url)
df.head(5)
Out[3]:
Income Lot_Size Ownership
0 60.0 18.4 Owner
1 85.5 16.8 Owner
2 64.8 21.6 Owner
3 61.5 20.8 Owner
4 87.0 23.6 Owner
In [4]:
df_own = df[df['Ownership'] == "Owner"]
df_own.head(5)
Out[4]:
Income Lot_Size Ownership
0 60.0 18.4 Owner
1 85.5 16.8 Owner
2 64.8 21.6 Owner
3 61.5 20.8 Owner
4 87.0 23.6 Owner
In [5]:
df_nown = df[df['Ownership'] != "Owner"]
df_nown
Out[5]:
Income Lot_Size Ownership
12 75.0 19.6 Nonowner
13 52.8 20.8 Nonowner
14 64.8 17.2 Nonowner
15 43.2 20.4 Nonowner
16 84.0 17.6 Nonowner
17 49.2 17.6 Nonowner
18 59.4 16.0 Nonowner
19 66.0 18.4 Nonowner
20 47.4 16.4 Nonowner
21 33.0 18.8 Nonowner
22 51.0 14.0 Nonowner
23 63.0 14.8 Nonowner
In [6]:
import matplotlib.pyplot as plt

plt.figure(figsize = (12,6))
plt.style.use('seaborn-whitegrid')

plt.title("Lot Size vs Income")

own = plt.scatter("Lot_Size", "Income", c ="yellow",  
            linewidths = 2, edgecolor ="grey", marker ="x",  
            s = 50, data = df_own) 
  
nown = plt.scatter("Lot_Size", "Income", c ="red", 
            linewidths = 2, edgecolor ="blue", 
            s = 50, alpha = 1, data = df_nown)

plt.xlabel('Lot Size')
plt.ylabel('Income')

plt.legend((own, nown), ('Owner', 'Non-Owner'),
           scatterpoints = 1, loc = 'lower right',
           ncol = 3, fontsize = 16)

plt.show()
  1. Laptop Sales at a London Computer Chain: The file LaptopSalesJanuary2008.csv contains data for all sales of laptops at a computer chain in London in January 2008. This is a subset of the full dataset that includes data for the entire year. Attempt the following:
In [7]:
import pandas as pd

import seaborn as sns
import matplotlib.pyplot as plt

url = "https://raw.githubusercontent.com/kwartler/Harvard_DataMining_Business_Student/master/BookDataSets/LaptopSalesJanuary2008.csv"

df = pd.read_csv(url)
df.head(5)
Out[7]:
Date Configuration Customer Postcode Store Postcode Retail Price Screen Size (Inches) Battery Life (Hours) RAM (GB) Processor Speeds (GHz) Integrated Wireless? HD Size (GB) Bundled Applications? OS X Customer OS Y Customer OS X Store OS Y Store CustomerStoreDistance
0 1/1/2008 0:01 163 EC4V 5BH SE1 2BN 455 15 5 1 2.0 Yes 80 Yes 532041 180995 534057.0 179682.0 2405.873022
1 1/1/2008 0:02 320 SW4 0JL SW12 9HD 545 15 6 1 2.0 No 300 No 529240 175537 528739.0 173080.0 2507.558574
2 1/1/2008 0:04 23 EC3V 1LR E2 0RY 515 15 4 1 2.0 Yes 300 Yes 533095 181047 535652.0 182961.0 3194.001409
3 1/1/2008 0:04 169 SW1P 3AU SE1 2BN 395 15 5 1 2.0 No 40 Yes 529902 179641 534057.0 179682.0 4155.202281
4 1/1/2008 0:06 365 EC4V 4EG SW1V 4QQ 585 15 6 2 2.0 No 120 Yes 531684 180948 528924.0 178440.0 3729.298057
  • Create a bar chart, showing the average retail price by store.
In [8]:
store_listt = df['Store Postcode'].unique()
store_listt
Out[8]:
array(['SE1 2BN', 'SW12 9HD', 'E2 0RY', 'SW1V 4QQ', 'SE8 3JD', 'SW18 1NN',
       'CR7 8LE', 'NW5 2QH', 'W4 3PH', 'SW1P 3AU', 'E7 8NW', 'N3 1DH',
       'W10 6HQ', 'KT2 5AU', 'N17 6QA', 'S1P 3AU'], dtype=object)
In [9]:
df_store = df.groupby(['Store Postcode']).mean()
df_store.head(5)
Out[9]:
Configuration Retail Price Screen Size (Inches) Battery Life (Hours) RAM (GB) Processor Speeds (GHz) HD Size (GB) OS X Customer OS Y Customer OS X Store OS Y Store CustomerStoreDistance
Store Postcode
CR7 8LE 210.100000 488.619048 15.0 5.152381 1.576190 1.742857 149.619048 533315.328571 169504.700000 532714.0 168302.0 2877.854275
E2 0RY 202.497664 483.171729 15.0 5.115654 1.528037 1.749416 146.401869 534541.171729 182031.205607 535652.0 182961.0 3747.600380
E7 8NW 209.402062 494.381443 15.0 5.185567 1.474227 1.742268 165.360825 540549.381443 184902.536082 541428.0 184515.0 2917.233443
KT2 5AU 213.238095 493.904762 15.0 5.161905 1.580952 1.795238 148.761905 519022.933333 171020.133333 517917.0 170243.0 3398.098902
N17 6QA 232.308943 494.634146 15.0 5.300813 1.577236 1.768293 143.577236 532185.853659 187191.943089 533788.0 189994.0 5181.657714
In [10]:
import numpy as np
import matplotlib.pyplot as plt 
 
courses = store_listt
values = list(df_store["Retail Price"])
  
fig = plt.figure(figsize = (10, 5))
 
plt.bar(courses, values, color ='blue', 
        width = 0.4)

plt.xticks(rotation = 45)

plt.xlabel("Stores")
plt.ylabel("Average Retail Price")
plt.title("Store vs Average Retail Price")
plt.show()
  • Which store has the highest average?
In [11]:
sorted_df = df_store["Retail Price"].sort_values()
sorted_df
Out[11]:
Store Postcode
W4 3PH      481.006289
E2 0RY      483.171729
SW12 9HD    485.295699
S1P 3AU     486.250000
NW5 2QH     486.580460
SE1 2BN     486.680195
N3 1DH      487.368421
SW1P 3AU    488.506858
CR7 8LE     488.619048
SW1V 4QQ    489.344978
W10 6HQ     489.866667
SE8 3JD     492.177778
SW18 1NN    493.038922
KT2 5AU     493.904762
E7 8NW      494.381443
N17 6QA     494.634146
Name: Retail Price, dtype: float64

Store with Pin code : N17 6QA has the largest Average Retail Price(494.63).

  • Which has the lowest?
In [12]:
sorted_df
Out[12]:
Store Postcode
W4 3PH      481.006289
E2 0RY      483.171729
SW12 9HD    485.295699
S1P 3AU     486.250000
NW5 2QH     486.580460
SE1 2BN     486.680195
N3 1DH      487.368421
SW1P 3AU    488.506858
CR7 8LE     488.619048
SW1V 4QQ    489.344978
W10 6HQ     489.866667
SE8 3JD     492.177778
SW18 1NN    493.038922
KT2 5AU     493.904762
E7 8NW      494.381443
N17 6QA     494.634146
Name: Retail Price, dtype: float64

Store with Pin code : W4 3PH has the lowest Average Retail Price(481).

  • Create side-by-side boxplots of retail price by store.
In [13]:
import plotly.express as px

px.box(df, x="Store Postcode", y="Retail Price")
  1. Shipments of Household Appliances: Line Graphs. The file ApplianceShipments.csv contains the series of quarterly shipments (in millions of dollars) of US household appliances between 1985 and 1989.
In [14]:
import pandas as pd

import seaborn as sns
import matplotlib.pyplot as plt

url = "https://raw.githubusercontent.com/toshihiroryuu/Dataset-test/main/ApplianceShipments.csv"

df = pd.read_csv(url, usecols = [0, 1])
df.head(5)
Out[14]:
Quarter Shipments
0 Q1-1985 4009
1 Q1-1986 4123
2 Q1-1987 4493
3 Q1-1988 4595
4 Q1-1989 4245
  • Create a well-formatted time plot of the data using Python.
In [15]:
import matplotlib.pyplot as plt

plt.figure(figsize=(8, 6))
plt.plot(df.Quarter, df.Shipments, color='magenta', marker='x', linestyle='dashed')
plt.xticks(rotation = 45)

plt.xlabel("Quarter")
plt.ylabel("Shipments")
plt.title("Quarter vs Shipments")

plt.show()
  • Does there appear to be a quarterly pattern? For a closer view of the patterns, zoom in to the range of 3500–5000 on the y-axis
In [16]:
import matplotlib.pyplot as plt

plt.figure(figsize=(12, 8))
plt.plot(df.Quarter, df.Shipments, color='magenta', marker='x', linestyle='dashed')
plt.xticks(rotation = 45)

plt.ylim=[3500, 5000]

plt.xlabel("Quarter")
plt.ylabel("Shipments")
plt.title("Quarter vs Shipments")

plt.show()
Yes, There is an Quartery pattern in the  plot. 
Total shipments increase in Q1 and Q2, while it decrease in the next two Quarters(Q3 and Q4).
  • Create one chart with four separate lines, one line for each of Q1, Q2, Q3, and Q4. (In Python, this can be achieved by add column for quarter and year. Then group the data frame by quarter and then plot shipment versus year for each quarter as a separate series on a line graph. Zoom in to the range of 3500–5000 on the y-axis. Does there appear to be a difference between quarters?
In [17]:
quar_list = df.Quarter.tolist()
quar_label =[]
year_label = []

for ele in quar_list:
    quar_label.append(ele.split("-")[0])
    year_label.append(ele.split("-")[1])
    
df["Quarter_label"] = quar_label
df["Year_label"] = year_label
df.head(5)
Out[17]:
Quarter Shipments Quarter_label Year_label
0 Q1-1985 4009 Q1 1985
1 Q1-1986 4123 Q1 1986
2 Q1-1987 4493 Q1 1987
3 Q1-1988 4595 Q1 1988
4 Q1-1989 4245 Q1 1989
In [18]:
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches

plt.figure(figsize=(12, 6))

q1 = plt.plot(df.Year_label[df.Quarter_label=="Q1"], df.Shipments[df.Quarter_label=="Q1"], 
         color='magenta', marker='x', linestyle='dashed')

q2 = plt.plot(df.Year_label[df.Quarter_label=="Q2"], df.Shipments[df.Quarter_label=="Q2"], 
         color='green', marker='x', linestyle='dashed')

q3 = plt.plot(df.Year_label[df.Quarter_label=="Q3"], df.Shipments[df.Quarter_label=="Q3"], 
         color='blue', marker='x', linestyle='dashed')

q4 = plt.plot(df.Year_label[df.Quarter_label=="Q4"], df.Shipments[df.Quarter_label=="Q4"], 
         color='yellow', marker='x', linestyle='dashed')

plt.xticks(rotation = 45)

plt.ylim=[3500, 5000]

plt.xlabel("Year", fontsize=16)
plt.ylabel("Shipments", fontsize=16)
plt.title("Year vs Shipments", fontsize=16)

q1_patch = mpatches.Patch(color='magenta', label='Quarter 1')
q2_patch = mpatches.Patch(color='green', label='Quarter 2')
q3_patch = mpatches.Patch(color='blue', label='Quarter 3')
q4_patch = mpatches.Patch(color='yellow', label='Quarter 4')

plt.legend(handles=[q1_patch, q2_patch, q3_patch, q4_patch], fontsize=14)


plt.show()
Quarter2 (Q2) always had an increease in shipment compared to previous years.
Quarter3 (Q3) had the highest shipment in the year 1986, but Quarter(Q2) has the highest shipment for all other years.
Quarter4 (Q4) has the lowest shipment througout the years except the year 1989.
Quarter1 and Quarter4 (Q1 and Q4) has lowest shipments than Q2 and Q3.
  • Create a line graph of the series at a yearly aggregated level (i.e., the total shipments in each year).
In [19]:
df_yr = df.groupby("Year_label").sum()
df_yr
Out[19]:
Shipments
Year_label
1985 16498
1986 17332
1987 18335
1988 18069
1989 18263
In [20]:
import matplotlib.pyplot as plt

plt.figure(figsize=(12, 8))
plt.plot(df_yr, color='red', marker='x', linestyle='dashed')
plt.xticks(rotation = 45)

plt.xlabel("Year", fontsize=16)
plt.ylabel("Total Shipments", fontsize=16)
plt.title("Year vs Total Shipments", fontsize=16)

plt.show()
  1. Illustrate by few example plots (minimum 5 plots/ tool):
In [21]:
import pandas as pd

import seaborn as sns
import matplotlib.pyplot as plt

url = "https://raw.githubusercontent.com/toshihiroryuu/Dataset-test/main/Credit.csv"

df = pd.read_csv(url)
df.head(5)
Out[21]:
Income Limit Rating Cards Age Education Gender Student Married Ethnicity Balance
0 14.891 3606 283 2 34 11 Male No Yes Caucasian 333
1 106.025 6645 483 3 82 15 Female Yes Yes Asian 903
2 104.593 7075 514 4 71 11 Male No No Asian 580
3 148.924 9504 681 3 36 11 Female No No Asian 964
4 55.882 4897 357 2 68 16 Male No Yes Caucasian 331
  • Plotly

Plotly - Plot 1 Bar plot

In [22]:
import plotly.express as px

fig = px.bar(df, x='Age', y='Balance')
fig.show()

Plotly Plot 2 - Sun Burst Chart

In [23]:
import plotly.express as px

fig = px.sunburst(df, path=["Gender", "Ethnicity", "Student", "Married"], values='Income')
fig.show()

Plotly - Plot 3 - Bubble Charts

In [24]:
import plotly.express as px
import plotly.graph_objects as go

fig = go.Figure(data=[go.Scatter(
    x=df["Age"], y=df["Rating"],
    mode='markers', marker_size=df["Cards"])
])

fig.show()

Plotly Plot 4 - Pie Chart

In [25]:
import plotly.express as px

fig = px.pie(df, values=df["Cards"], names=df["Gender"], color_discrete_sequence=px.colors.sequential.RdBu)
fig.show()

Plotly Plot 5 - Scatter Plot

In [26]:
import plotly.express as px

fig = px.scatter(df, x="Age", y="Income")
fig.show()
  • Bokeh
In [27]:
# Show Output inline jupyter notebook
from bokeh.io import output_notebook

output_notebook()
Loading BokehJS ...

Bokeh Plot 1 - Scatter Plot

In [28]:
from bokeh.plotting import figure, show

p = figure(tooltips=[("x", "$x"), ("y", "$y")])
p.x_range.range_padding = p.y_range.range_padding = 0

p.circle(x="Age", y="Income", source=df,
         size=10, color='Blue')

p.grid.grid_line_width = 0.5

p.title.text ='Age vs Income - Scatter Plot'
p.xaxis.axis_label = 'Age'
p.yaxis.axis_label = 'Income'

show(p)

Bokeh Plot 2 - Bar Chart

In [29]:
import pandas as pd

url = "https://raw.githubusercontent.com/toshihiroryuu/Dataset-test/main/Minard_temp.csv"

df = pd.read_csv(url)
df.rename(columns = {'Unnamed: 0':'ID'}, inplace = True)
df.head(5)
Out[29]:
ID long temp days date
0 1 37.6 0 6 Oct18
1 2 36.0 0 6 Oct24
2 3 33.2 -9 16 Nov09
3 4 32.0 -21 5 Nov14
4 5 29.2 -11 10 NaN
In [30]:
from bokeh.plotting import figure, show

s = figure(tooltips=[("x", "$x"), ("y", "$y")])
s.x_range.range_padding = p.y_range.range_padding = 0

s.vbar(x='ID', top='long', source=df, width=0.70)

s.title.text ='ID vs Long  - Bar Chart'
s.xaxis.axis_label = 'ID'
s.yaxis.axis_label = 'Long'

show(s)

Bokeh Plot 3 - Line Plot

In [31]:
from bokeh.plotting import figure, show

k = figure(tooltips=[("x", "$x"), ("y", "$y")], plot_width=600, plot_height=300)

k.line(df.ID, df.long, line_width=2)

k.title.text ='ID vs Long  - Line Plot'
k.xaxis.axis_label = 'ID'
k.yaxis.axis_label = 'Long'

show(k)

Bokeh Plot 4 - Area Plot

In [32]:
from bokeh.plotting import figure, show

t = figure(tooltips=[("x", "$x"), ("y", "$y")], plot_width=600, plot_height=300)

t.varea(x = df.ID, y1 = df.long, fill_color="green")

t.title.text ='ID vs Long - Area Plot'
t.xaxis.axis_label = 'ID'
t.yaxis.axis_label = 'Long'
 
show(t)

Bokeh Plot 5 - Step Plot

In [33]:
from bokeh.plotting import figure, show

j = figure(plot_width=600, plot_height=300)

j.step(df.ID, df.long, line_width=2, mode="center")

j.title.text ='ID vs Long - Step Plot'
j.xaxis.axis_label = 'ID'
j.yaxis.axis_label = 'Long'

show(j)
  • Tableau

or

Tableau - Plot 1 : Rect Chart

HTML Embeddings
In [34]:
%%HTML

<div class='tableauPlaceholder' id='viz1616512406146' style='position: relative'>
<noscript><a href='#'><img alt=' ' src='https:&#47;&#47;public.tableau.com&#47;static&#47;images&#47;In&#47;InsuranceAnalysis_16163072902500&#47;Age&#47;1_rss.png' style='border: none' /></a></noscript>
<object class='tableauViz'  style='display:none;'>
<param name='host_url' value='https%3A%2F%2Fpublic.tableau.com%2F' />
<param name='embed_code_version' value='3' />
<param name='site_root' value='' />
<param name='name' value='InsuranceAnalysis_16163072902500&#47;Age' />
<param name='tabs' value='yes' />
<param name='toolbar' value='yes' /
<param name='static_image' value='https:&#47;&#47;public.tableau.com&#47;static&#47;images&#47;In&#47;InsuranceAnalysis_16163072902500&#47;Age&#47;1.png' />
<param name='animate_transition' value='yes' />
<param name='display_static_image' value='yes' />
<param name='display_spinner' value='yes' />
<param name='display_overlay' value='yes' />
<param name='display_count' value='yes' />
<param name='language' value='en' />
<param name='filter' value='publish=yes' />
</object>
</div>                

<script type='text/javascript'>                    
var divElement = document.getElementById('viz1616512406146');                    
var vizElement = divElement.getElementsByTagName('object')[0];                    
vizElement.style.width='100%';vizElement.style.height=(divElement.offsetWidth*0.75)+'px';                    
var scriptElement = document.createElement('script');                    
scriptElement.src = 'https://public.tableau.com/javascripts/api/viz_v1.js';                    
vizElement.parentNode.insertBefore(scriptElement, vizElement);               
</script>

Tableau - Plot 2 : Scatter Plot

HTML Embeddings
In [35]:
%%HTML

<div class='tableauPlaceholder' id='viz1616512445707' style='position: relative'><noscript><a href='#'>
<img alt=' ' src='https:&#47;&#47;public.tableau.com&#47;static&#47;images&#47;In&#47;InsuranceAnalysis_16163072902500&#47;AgevsBMIScatterplot&#47;1_rss.png' style='border: none' /></a>
</noscript><object class='tableauViz'  style='display:none;'>
<param name='host_url' value='https%3A%2F%2Fpublic.tableau.com%2F' />
<param name='embed_code_version' value='3' /> 
<param name='site_root' value='' />
<param name='name' value='InsuranceAnalysis_16163072902500&#47;AgevsBMIScatterplot' />
<param name='tabs' value='yes' />
<param name='toolbar' value='yes' />
<param name='static_image' value='https:&#47;&#47;public.tableau.com&#47;static&#47;images&#47;In&#47;InsuranceAnalysis_16163072902500&#47;AgevsBMIScatterplot&#47;1.png' />
<param name='animate_transition' value='yes' />
<param name='display_static_image' value='yes' />
<param name='display_spinner' value='yes' />
<param name='display_overlay' value='yes' />
<param name='display_count' value='yes' />
<param name='language' value='en' />
<param name='filter' value='publish=yes' />
</object>
</div>                

<script type='text/javascript'>                    
var divElement = document.getElementById('viz1616512445707');                    
var vizElement = divElement.getElementsByTagName('object')[0];                    
vizElement.style.width='100%';vizElement.style.height=(divElement.offsetWidth*0.75)+'px';                    
var scriptElement = document.createElement('script');                    
scriptElement.src = 'https://public.tableau.com/javascripts/api/viz_v1.js';                    
vizElement.parentNode.insertBefore(scriptElement, vizElement);                
</script>

Tableau - Plot 3 : Line Plot

HTML Embeddings
In [36]:
%%HTML

<div class='tableauPlaceholder' id='viz1616512465515' style='position: relative'>
<noscript><a href='#'>
<img alt=' ' src='https:&#47;&#47;public.tableau.com&#47;static&#47;images&#47;In&#47;InsuranceAnalysis_16163072902500&#47;AgevsSmoking&#47;1_rss.png' style='border: none' /></a>
</noscript>
<object class='tableauViz'  style='display:none;'><param name='host_url' value='https%3A%2F%2Fpublic.tableau.com%2F' /> 
<param name='embed_code_version' value='3' /> 
<param name='site_root' value='' />
<param name='name' value='InsuranceAnalysis_16163072902500&#47;AgevsSmoking' />
<param name='tabs' value='yes' />
<param name='toolbar' value='yes' />
<param name='static_image' value='https:&#47;&#47;public.tableau.com&#47;static&#47;images&#47;In&#47;InsuranceAnalysis_16163072902500&#47;AgevsSmoking&#47;1.png' />
<param name='animate_transition' value='yes' />
<param name='display_static_image' value='yes' />
<param name='display_spinner' value='yes' />
<param name='display_overlay' value='yes' />
<param name='display_count' value='yes' />
<param name='language' value='en' />
<param name='filter' value='publish=yes' />
</object>
</div>                

<script type='text/javascript'>                    
var divElement = document.getElementById('viz1616512465515');                    
var vizElement = divElement.getElementsByTagName('object')[0];                    
vizElement.style.width='100%';vizElement.style.height=(divElement.offsetWidth*0.75)+'px';                    
var scriptElement = document.createElement('script');                    
scriptElement.src = 'https://public.tableau.com/javascripts/api/viz_v1.js';                    
vizElement.parentNode.insertBefore(scriptElement, vizElement);                
</script>

Tableau - Plot 4 : Bubble Chart

HTML Embeddings
In [37]:
%%HTML

<div class='tableauPlaceholder' id='viz1616512491809' style='position: relative'><noscript><a href='#'>
<img alt=' ' src='https:&#47;&#47;public.tableau.com&#47;static&#47;images&#47;In&#47;InsuranceAnalysis_16163072902500&#47;ChildrenvsMaxcharges&#47;1_rss.png' style='border: none' /></a>
</noscript>
<object class='tableauViz'  style='display:none;'>
<param name='host_url' value='https%3A%2F%2Fpublic.tableau.com%2F' /> 
<param name='embed_code_version' value='3' /> 
<param name='site_root' value='' />
<param name='name' value='InsuranceAnalysis_16163072902500&#47;ChildrenvsMaxcharges' />
<param name='tabs' value='yes' />
<param name='toolbar' value='yes' />
<param name='static_image' value='https:&#47;&#47;public.tableau.com&#47;static&#47;images&#47;In&#47;InsuranceAnalysis_16163072902500&#47;ChildrenvsMaxcharges&#47;1.png' />
<param name='animate_transition' value='yes' />
<param name='display_static_image' value='yes' />
<param name='display_spinner' value='yes' />
<param name='display_overlay' value='yes' />
<param name='display_count' value='yes' />
<param name='language' value='en' />
<param name='filter' value='publish=yes' />
</object>
</div>                

<script type='text/javascript'>                    
var divElement = document.getElementById('viz1616512491809');                    
var vizElement = divElement.getElementsByTagName('object')[0];                    
vizElement.style.width='100%';vizElement.style.height=(divElement.offsetWidth*0.75)+'px';                    
var scriptElement = document.createElement('script');                    
scriptElement.src = 'https://public.tableau.com/javascripts/api/viz_v1.js';                    
vizElement.parentNode.insertBefore(scriptElement, vizElement);                
</script>

Tableau - Plot 5 : Scatter Plot

HTML Embeddings
In [38]:
%%HTML

<div class='tableauPlaceholder' id='viz1616512513870' style='position: relative'>
<noscript><a href='#'>
<img alt=' ' src='https:&#47;&#47;public.tableau.com&#47;static&#47;images&#47;In&#47;InsuranceAnalysis_16163072902500&#47;BMIvsCharges&#47;1_rss.png' style='border: none' />
</a></noscript>
<object class='tableauViz'  style='display:none;'>
<param name='host_url' value='https%3A%2F%2Fpublic.tableau.com%2F' /> 
<param name='embed_code_version' value='3' />
<param name='site_root' value='' />
<param name='name' value='InsuranceAnalysis_16163072902500&#47;BMIvsCharges' />
<param name='tabs' value='yes' />
<param name='toolbar' value='yes' />
<param name='static_image' value='https:&#47;&#47;public.tableau.com&#47;static&#47;images&#47;In&#47;InsuranceAnalysis_16163072902500&#47;BMIvsCharges&#47;1.png' />
<param name='animate_transition' value='yes' />
<param name='display_static_image' value='yes' />
<param name='display_spinner' value='yes' />
<param name='display_overlay' value='yes' />
<param name='display_count' value='yes' />
<param name='language' value='en' />
<param name='filter' value='publish=yes' />
</object>
</div>                

<script type='text/javascript'>                    
var divElement = document.getElementById('viz1616512513870');                    
var vizElement = divElement.getElementsByTagName('object')[0];                    
vizElement.style.width='100%';vizElement.style.height=(divElement.offsetWidth*0.75)+'px';                    
var scriptElement = document.createElement('script');                    
scriptElement.src = 'https://public.tableau.com/javascripts/api/viz_v1.js';                    
vizElement.parentNode.insertBefore(scriptElement, vizElement);                
</script>

Tableau - Plot 6 : Interactive Bubble Plot

HTML Embeddings
In [39]:
%%HTML

<div class='tableauPlaceholder' id='viz1616512536878' style='position: relative'>
<noscript><a href='#'>
<img alt=' ' src='https:&#47;&#47;public.tableau.com&#47;static&#47;images&#47;In&#47;InsuranceAnalysis_16163072902500&#47;Region&#47;1_rss.png' style='border: none' /></a>
</noscript>
<object class='tableauViz'  style='display:none;'><param name='host_url' value='https%3A%2F%2Fpublic.tableau.com%2F' />
<param name='embed_code_version' value='3' />
<param name='site_root' value='' />
<param name='name' value='InsuranceAnalysis_16163072902500&#47;Region' />
<param name='tabs' value='yes' />
<param name='toolbar' value='yes' />
<param name='static_image' value='https:&#47;&#47;public.tableau.com&#47;static&#47;images&#47;In&#47;InsuranceAnalysis_16163072902500&#47;Region&#47;1.png' /> 
<param name='animate_transition' value='yes' />
<param name='display_static_image' value='yes' />
<param name='display_spinner' value='yes' />
<param name='display_overlay' value='yes' />
<param name='display_count' value='yes' />
<param name='language' value='en' />
<param name='filter' value='publish=yes' />
</object>
</div>               

<script type='text/javascript'>                    
var divElement = document.getElementById('viz1616512536878');                    
var vizElement = divElement.getElementsByTagName('object')[0];                    
vizElement.style.width='100%';vizElement.style.height=(divElement.offsetWidth*0.75)+'px';                    
var scriptElement = document.createElement('script');                    
scriptElement.src = 'https://public.tableau.com/javascripts/api/viz_v1.js';                    
vizElement.parentNode.insertBefore(scriptElement, vizElement);               
</script>

Tableau - Plot 7 : Map

HTML Embeddings
In [40]:
%%HTML

<div class='tableauPlaceholder' id='viz1616512586269' style='position: relative'>
<noscript><a href='#'><img alt=' ' src='https:&#47;&#47;public.tableau.com&#47;static&#47;images&#47;In&#47;InsuranceAnalysis_16163072902500&#47;Map&#47;1_rss.png' style='border: none' /></a>
</noscript><object class='tableauViz'  style='display:none;'><param name='host_url' value='https%3A%2F%2Fpublic.tableau.com%2F' /> 
<param name='embed_code_version' value='3' /> 
<param name='site_root' value='' />
<param name='name' value='InsuranceAnalysis_16163072902500&#47;Map' />
<param name='tabs' value='yes' />
<param name='toolbar' value='yes' />
<param name='static_image' value='https:&#47;&#47;public.tableau.com&#47;static&#47;images&#47;In&#47;InsuranceAnalysis_16163072902500&#47;Map&#47;1.png' /> <param name='animate_transition' value='yes' />
<param name='display_static_image' value='yes' />
<param name='display_spinner' value='yes' />
<param name='display_overlay' value='yes' />
<param name='display_count' value='yes' />
<param name='language' value='en' />
<param name='filter' value='publish=yes' />
</object>
</div>                

<script type='text/javascript'>                    
var divElement = document.getElementById('viz1616512586269');                    
var vizElement = divElement.getElementsByTagName('object')[0];                    
vizElement.style.width='100%';vizElement.style.height=(divElement.offsetWidth*0.75)+'px';                    
var scriptElement = document.createElement('script');                    
scriptElement.src = 'https://public.tableau.com/javascripts/api/viz_v1.js';                    
vizElement.parentNode.insertBefore(scriptElement, vizElement);                
</script>

Tableau - Plot 8 : Tabelau Dash Board

HTML Embeddings
In [41]:
%%HTML

<div class='tableauPlaceholder' id='viz1616512643321' style='position: relative'>
<noscript><a href='#'><img alt=' ' src='https:&#47;&#47;public.tableau.com&#47;static&#47;images&#47;In&#47;InsuranceAnalysis_16163072902500&#47;Dashboard1&#47;1_rss.png' style='border: none' /></a></noscript>
<object class='tableauViz'  style='display:none;'>
<param name='host_url' value='https%3A%2F%2Fpublic.tableau.com%2F' />
<param name='embed_code_version' value='3' />
<param name='site_root' value='' />
<param name='name' value='InsuranceAnalysis_16163072902500&#47;Dashboard1' />
<param name='tabs' value='yes' />
<param name='toolbar' value='yes' />
<param name='static_image' value='https:&#47;&#47;public.tableau.com&#47;static&#47;images&#47;In&#47;InsuranceAnalysis_16163072902500&#47;Dashboard1&#47;1.png' /> <param name='animate_transition' value='yes' />
<param name='display_static_image' value='yes' />
<param name='display_spinner' value='yes' />
<param name='display_overlay' value='yes' />
<param name='display_count' value='yes' />
<param name='language' value='en' />
<param name='filter' value='publish=yes' />
</object>
</div>                

<script type='text/javascript'>                    
var divElement = document.getElementById('viz1616512643321');                    
var vizElement = divElement.getElementsByTagName('object')[0];                    
if ( divElement.offsetWidth > 800 ) { vizElement.style.width='100%';vizElement.style.height=(divElement.offsetWidth*0.75)+'px';} else if ( divElement.offsetWidth > 500 ) { vizElement.style.width='100%';vizElement.style.height=(divElement.offsetWidth*0.75)+'px';} else { vizElement.style.width='100%';vizElement.style.minHeight='1850px';vizElement.style.maxHeight=(divElement.offsetWidth*1.77)+'px';}                     
var scriptElement = document.createElement('script');                    
scriptElement.src = 'https://public.tableau.com/javascripts/api/viz_v1.js';                    
vizElement.parentNode.insertBefore(scriptElement, vizElement);                
</script>